package unit8;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class Ex8_7_Example8_7 {
    public static void main(String[] args) {
        try {
            File file = new File("D:\\stu\\student.txt");
            // 创建C:\stu\student.txt文件
            file.createNewFile();
            // 创建FileWriter对象
            FileWriter fwriter = new FileWriter(file);
            // 向文件写入内容
            fwriter.write("少年强则国强");
            fwriter.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
